<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .div1{
            width: 100px;
            height: 100px;
            background: aqua;
            margin: auto;
            position: absolute;/*关键在于绝对定位，但是为什么可以实现水平及垂直居中？*/
            left: 0px;
            top: 0px;
            right: 0px;
            bottom: 0px;
        }
    </style>
</head>
<body>
<div class="div1">
</div>
</body>
</html>